package com.giaothong.customview.adapter;

import java.util.ArrayList;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;

import com.giaothong.customview.LocationInfoItemView;
import com.giaothong.model.entity.LocationSearchEntity;

public class ListLocationAdapter extends ArrayAdapter<LocationSearchEntity> {

	public ListLocationAdapter(Context context, int textViewResourceId, ArrayList<LocationSearchEntity> objects) {
		super(context, textViewResourceId, objects);
	}

	public View getView(final int position, View convertView, ViewGroup parent) {
		if (convertView == null) {
			convertView = new LocationInfoItemView(getContext());
		}

		LocationInfoItemView locationInfoItemView = (LocationInfoItemView) convertView;
		locationInfoItemView.setData(getItem(position));
		// setData item position
		return convertView;

	}

}
